package com.ymatou.app.rec.testcase;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.ymatou.app.rec.parameter.JyhBean;
import com.ymatou.app.rec.service.JyhCall;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.TestCase;
import com.ymt.utils.annotation.TestSuite;
import com.ymt.utils.tag.P1;
/**
*视频直播搜索接口
*FreeMaker Template自动生成代码
*/

@TestSuite
public class Ts_Jyh{
	private static JyhBean jyhinterestBean;
	private static JyhCall jyhinterestCall;
	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("直播搜索接口");
	}

	@Before
	public void caseUp() {
		jyhinterestBean=new JyhBean();
		jyhinterestCall=new JyhCall();
		//固定参数传值
		jyhinterestBean.setAppkey(3);
		jyhinterestBean.setExplain("False");
		jyhinterestBean.setModule("pdt_list_md");
		jyhinterestBean.setPlatform("appbuyer");
		jyhinterestBean.setRequestid("22624344952400001322470125961");
		
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(jyhinterestCall.getOpurl());
		
	}

	@After
	public void caseDown() {
		Logger.end();
	}
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_jyhInterest_001() {
		Logger.start(true,"检查接口返回是否存在异常");
		try {
			//TODO 补全case代码
			//org.junit.Assert.fail();
			jyhinterestBean.setFilter("and(term(ibrandid,10134))");
			jyhinterestBean.setFl("sproductid,source");
			jyhinterestBean.setLimit("0,20");
			jyhinterestBean.setQuery("keyword(mixkeyword,测试)");
			
			jyhinterestCall.setData(jyhinterestBean);
			jyhinterestCall.callService();			
			Logger.comment("jyhinterestCall send:" + jyhinterestCall.getEntityString());
			Logger.comment("jyhinterestCall response:" + jyhinterestCall.getReturnData());
			Logger.verifyEquals("OK",jyhinterestCall.getStatus(), "接口状态返回成功");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_jyhInterest_002() {
		Logger.start(true,"按关键字搜索商品");
		try {
			//TODO 补全case代码
			//org.junit.Assert.fail();
			jyhinterestBean.setQuery("keyword(mixkeyword,测试)");
			jyhinterestCall.setData(jyhinterestBean);
			jyhinterestCall.callService();			
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_jyhInterest_003() {
		Logger.start(true,"按关键字搜索品牌");
		try {
			//TODO 补全case代码
			//org.junit.Assert.fail();
			jyhinterestBean.setFilter("term(ibrandid,10134)");
			jyhinterestCall.setData(jyhinterestBean);
			jyhinterestCall.callService();			
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_jyhInterest_004() {
		Logger.start(true,"按关键字搜索类目");
		try {
			//TODO 补全case代码
			//org.junit.Assert.fail();
			jyhinterestBean.setFilter("term(fparentcategoryarrayids,1130)");
			jyhinterestCall.setData(jyhinterestBean);
			jyhinterestCall.callService();			
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_jyhInterest_005() {
		Logger.start(true,"接口返回总记录数");
		try {
			//TODO 补全case代码
			//org.junit.Assert.fail();
			jyhinterestCall.setData(jyhinterestBean);
			jyhinterestCall.callService();			
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_jyhInterest_006() {
		Logger.start(true,"接口分页");
		try {
			//TODO 补全case代码
			//org.junit.Assert.fail();
			jyhinterestCall.setData(jyhinterestBean);
			jyhinterestCall.callService();			
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
}